import {NodeTypes} from "../NodeTypes";
import {EStatus} from "../EStatus";

export const MoveTo = {
    type: NodeTypes.Leaf,
    initializer(){
        console.log("初始化");
    },
    action(creep: Creep, target, opts) {
        const result: number = creep.moveTo(target);
        switch (result) {
            case OK:
                return EStatus.Success;
            case ERR_NOT_IN_RANGE:
            case ERR_NO_PATH:
            case ERR_BUSY:
            case ERR_NOT_FOUND:
            case ERR_INVALID_TARGET:
            case ERR_TIRED:
            case ERR_NO_BODYPART:
                return EStatus.Failure;
        }
    }
}
